Fix some possible crashes. (#468832, Michal Luczaj)
authorMatthias Clasen <mclasen@redhat.com>
Sat, 8 Sep 2007 05:16:03 +0000 (05:16 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Sat, 8 Sep 2007 05:16:03 +0000 (05:16 +0000)
2007-09-08  Matthias Clasen  <mclasen@redhat.com>

        * io-ani.c: Fix some possible crashes.  (#468832, Michal Luczaj)

svn path=/trunk/; revision=18759

gdk-pixbuf/ChangeLog
gdk-pixbuf/io-ani.c

index 17c289d4e0f3c03d4e59a0b02cc0902bb109f69f..6cf3957d4301ecdf003f6a262ecfd20229d752c5 100644 (file)
@@ -1,3 +1,7 @@
+2007-09-08  Matthias Clasen  <mclasen@redhat.com>
+
+       * io-ani.c: Fix some possible crashes.  (#468832, Michal Luczaj)
+
 2007-09-07  Matthias Clasen  <mclasen@redhat.com>
 
        * io-tga.c (gdk_pixbuf__tga_stop_load): Handle pbuf 
index 6ac343c0c658caad777af2770b4f86fd368709c9..65e560b8ba9bc4988f8d22b56190066a3c02c910 100644 (file)
@@ -398,6 +398,15 @@ ani_load_chunk (AniLoaderContext *context, GError **error)
                                     _("Malformed chunk in animation"));
                        return FALSE; 
                }
+               if (!context->animation) 
+               {
+                       g_set_error (error,
+                                    GDK_PIXBUF_ERROR,
+                                    GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
+                                    _("Invalid header in animation"));
+                       return FALSE;
+               }
+
                context->animation->total_time = 0;
                for (i = 0; i < context->NumSteps; i++) 
                {
@@ -415,6 +424,14 @@ ani_load_chunk (AniLoaderContext *context, GError **error)
                                     _("Malformed chunk in animation"));
                        return FALSE; 
                }
+               if (!context->animation) 
+               {
+                       g_set_error (error,
+                                    GDK_PIXBUF_ERROR,
+                                    GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
+                                    _("Invalid header in animation"));
+                       return FALSE;
+               }
                for (i = 0; i < context->NumSteps; i++) 
                {
                        context->animation->sequence[i] = read_int32 (context);
@@ -430,6 +447,14 @@ ani_load_chunk (AniLoaderContext *context, GError **error)
        }
         else if (context->chunk_id == TAG_INAM) 
        {
+               if (!context->animation) 
+               {
+                       g_set_error (error,
+                                    GDK_PIXBUF_ERROR,
+                                    GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
+                                    _("Invalid header in animation"));
+                       return FALSE;
+               }
                context->title = g_try_malloc (context->chunk_size + 1);
                if (!context->title) 
                {
@@ -449,6 +474,14 @@ ani_load_chunk (AniLoaderContext *context, GError **error)
        }
         else if (context->chunk_id == TAG_IART) 
        {
+               if (!context->animation) 
+               {
+                       g_set_error (error,
+                                    GDK_PIXBUF_ERROR,
+                                    GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
+                                    _("Invalid header in animation"));
+                       return FALSE;
+               }
                context->author = g_try_malloc (context->chunk_size + 1);
                if (!context->author) 
                {